package cn.micai.base.lambda;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 描述：
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/6/21 17:35
 */
public class StreamToListExample {

    public static void main(String [] args) {

        Stream<String> language = Stream.of("java", "python", "node");

        // Convert a Stream to List
        List<String> result = language.collect(Collectors.toList());

        result.forEach(System.out::println);

        Stream<Integer> num = Stream.of(1, 2, 3, 4, 5);

        List<Integer> result2 = num.filter(x -> x != 3).collect(Collectors.toList());

        result2.forEach(x -> System.out.println(x));

    }
}
